home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / etc / network / if-down.d / avahi-autoipd next >
Text File  |  2008-07-27  |  979b  |  33 lines

  1. #!/bin/sh -e
  2. # Description:      Remove routes to allow communication between machines which
  3. #                   only have an IPv4LL address assigned and those which only
  4. #                   have a routable address assigned. These were added by
  5. #                   /etc/network/if-up.d/avahi-autoipd.
  6. #
  7. #                   See http://developer.apple.com/qa/qa2004/qa1357.html for
  8. #                   more information.
  9.  
  10.  
  11. [ "$IFACE" != "lo" ] || exit 0
  12. case "$ADDRFAM" in
  13.   inet|NetworkManager) ;;
  14.   *) exit 0
  15. esac
  16. case "$METHOD" in
  17.     static|dhcp|NetworkManager) ;;
  18.     *) exit 0
  19. esac
  20.  
  21. if [ -x /bin/ip ]; then
  22.     # route already present?
  23.     ip route show | grep -q '^169.254.0.0/16[[:space:]]' && exit 0
  24.  
  25.     /bin/ip route del 169.254.0.0/16 dev $IFACE metric 1000 scope link || true
  26. elif [ -x /sbin/route ]; then
  27.     # route already present?
  28.     /sbin/route -n | grep -q "^169.254.0.0[[:space:]]" && exit 0
  29.  
  30.     /sbin/route del -net 169.254.0.0 netmask 255.255.0.0 dev $IFACE metric 1000 || true
  31. fi
  32.  
  33.